﻿using System;
using System.Collections.Generic;
using System.Text;

namespace PCR.Logic
{
    using PCR.Base;
        
    /// <summary>
    /// Application configuration manager,
    /// Contain all the global setting and resource loading
    /// </summary>
    internal class ConfigManager : IConfigManager
    {
        IDatabase _database = null;
        
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="database">Database interface<param>
        public ConfigManager(IDatabase database)
        {
            System.Diagnostics.Debug.Assert(database != null);
            this._database = database;
        }
        
        public string GetString(string name)
        {
            throw new NotImplementedException();
        }

        public object GetObject(string name)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Get the max value
        /// </summary>
        public double MaxValue 
        {
            get { return this._maxValue; }
        }
        double _maxValue = 10000000000000;

        /// <summary>
        /// Get the min value
        /// </summary>
        public double MinValue 
        {
            get { return this._minValue; }
        }
        double _minValue = 0;

        /// <summary>
        /// Get or set the skin name
        /// </summary>
        public string Skin 
        {
            get { return this._skin; }
            set { this._skin = value; }
        }
        string _skin = @"skins\DiamondBlue.ssk";

        /// <summary>
        /// Get the software name
        /// </summary>
        public string SoftwareName 
        { 
            // Should get from the database, 
            // we get the fixed name current now
            get { return this._softwareName; }
        }
        string _softwareName = "HPV分型定量分析系统";

        /// <summary>
        /// Get or set the max CT value
        /// </summary>
        public double MaxCTVal 
        {
            get { return this._maxCTVal; }
        }
        double _maxCTVal = 35;

        /// <summary>
        /// Get or set the min CT value
        /// </summary>
        public double MinCTVal 
        {
            get { return this._minCTValue; }
        }
        double _minCTValue = 0;

        /// <summary>
        /// Get the global double digital precision count
        /// Use Math.Round(value, DigitialPrecision);
        /// </summary>
        public int DigitialPrecision 
        { 
            get { return this._digitialPrecision; }
        }
        int _digitialPrecision = 5;

        /// <summary>
        /// Get or set the printing setting
        /// </summary>
        public IPrintingSetting PrintingSetting 
        {
            get { return  this._database.Config.PrintingSetting; }
            set { this._database.Config.PrintingSetting = value; }
        }
    }
}
